//
//  UserFinanceTableViewCell.m
//  XinKaiFa55like
//
//  Created by junseek on 2017/3/24.
//  Copyright © 2017年 55like lj. All rights reserved.
//

#import "UserFinanceTableViewCell.h"

@interface UserFinanceTableViewCell (){
    //
    
    UILabel *lblMonth;
    UILabel *lblachievement;
    UILabel *lblexpenditure;
    UILabel *lblprofit;

    
    NSIndexPath *tempIndexPath;
    NSDictionary *tempDic;
   
}


@end

@implementation UserFinanceTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor=[UIColor whiteColor];
        
        float fw=kScreenWidth/4;
        lblMonth=[RHMethods labelWithFrame:CGRectMake(0, 0, fw, 40) font:fontTitle color:rgbTitleColor text:@"" textAlignment:NSTextAlignmentCenter];
        [self addSubview:lblMonth];
        
        lblachievement=[RHMethods labelWithFrame:CGRectMake(XW(lblMonth), 0, fw, 40) font:fontTitle color:rgbTitleColor text:@"" textAlignment:NSTextAlignmentCenter];
        [self addSubview:lblachievement];
        
        lblexpenditure=[RHMethods labelWithFrame:CGRectMake(XW(lblachievement), 0, fw, 40) font:fontTitle color:rgbTitleColor text:@"" textAlignment:NSTextAlignmentCenter];
        [self addSubview:lblexpenditure];
        
        lblprofit=[RHMethods labelWithFrame:CGRectMake(XW(lblexpenditure), 0, fw, 40) font:fontTitle color:rgbTitleColor text:@"" textAlignment:NSTextAlignmentCenter];
        [self addSubview:lblprofit];
        
        [self addSubview:[RHMethods lineViewWithFrame:CGRectMake(0, 39.5, kScreenWidth, 0.5)]];
        [self setSelectionStyle:UITableViewCellSelectionStyleNone];
    }
    return self;
}

//内容更新
-(void)setValueForDictionary:(NSDictionary *)dic indexPath:(NSIndexPath *)indexPath type:(NSString *)strType{
    tempIndexPath=indexPath;
    tempDic=dic;
    
    lblMonth.text=[dic valueForJSONStrKey:@"ctime"];
    lblachievement.text=[NSString stringWithFormat:@"+%@",[dic valueForJSONStrKey:@"performance"]];
    lblexpenditure.text=[NSString stringWithFormat:@"-%@",[dic valueForJSONStrKey:@"expend"]];
    lblprofit.text=[dic valueForJSONStrKey:@"profit"];
//    if (indexPath.row>5) {
        lblprofit.textColor=[UIColor redColor];
//    }else{
//        lblprofit.textColor=RGBCOLOR(0, 165, 99);
//    }
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
